public class Test5 {
    public static void main(String[] args) throws InterruptedException {
        Object o1 = new Object();
        Thread t1 = new Thread(()->{
                  System.out.println("t1运行");
                  try {
                      System.out.println("t1 , 3秒后wait");
                      Thread.sleep(3000);
                      synchronized(o1){
                          o1.wait();
                      }
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
        });
        Thread t2 = new Thread(()->{
            System.out.println("t2,5秒后notify唤醒t1");
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            synchronized(o1){
                o1.notify();
            }
        });
        t1.start();
        t2.start();


    }
}
